package com.github.ecbp.store.service.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.ecbp.common.data.entity.BaseEntity;
import com.github.ecbp.common.data.service.impl.BaseServiceImpl;
import com.github.ecbp.store.service.entity.ProductVertifyRecord;
import com.github.ecbp.store.service.mapper.ProductVertifyRecordMapper;
import com.github.ecbp.store.service.service.ProductVertifyRecordService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @Author Created by Alex·He on 2020/4/30 22:26
 * @Version V1.0
 * @Description: 商品审核记录表(ProductVertifyRecord)表服务实现类
 */
@Service
public class ProductVertifyRecordServiceImpl extends BaseServiceImpl<ProductVertifyRecordMapper, ProductVertifyRecord>
        implements ProductVertifyRecordService {

    /**
     *功能描述：
     * @author Created by Alex·He on 2020/5/7 14:21
     * @version 1.0
     * @description 模糊查询的参数组合，可通过审核人、审核状态进行单独或者联合查询
     */
    @Override
    protected void assemble(ProductVertifyRecord entity, LambdaQueryWrapper<ProductVertifyRecord> wrapper) {
        super.assemble(entity, wrapper);
        if (!StringUtils.isEmpty(entity.getVertifyMan())) {
            wrapper.likeRight(ProductVertifyRecord::getVertifyMan, entity.getVertifyMan());
        }
        if (!StringUtils.isEmpty(entity.getVerifyStatus())) {
            wrapper.likeRight(ProductVertifyRecord::getVerifyStatus, entity.getVerifyStatus());
        }
        wrapper.orderByDesc(BaseEntity::getCreateTime);
    }
}
